﻿using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;

namespace Study002__BookStoreApi.Models
{
	public class Book
	{
        /// <summary>
        /// [BsonId]：以将此属性指定为文档的主键。
        /// [BsonRepresentation(BsonType.ObjectId)]：以允许将参数作为类型string结构传递。 Mongo 处理从 string 到 ObjectId 的转换
        /// </summary>
        [BsonId]
        [BsonRepresentation(BsonType.ObjectId)]
        public string? Id { get; set; }

        /// <summary>
        /// [BsonElement("Name")]：Name 的属性值表示 MongoDB 集合中的属性名称
        /// </summary>
        [BsonElement("Name")]
        public string BookName { get; set; } = null!;

        public decimal Price { get; set; }

        public string Category { get; set; } = null!;

        public string Author { get; set; } = null!;
    }
}

